package com.cloud.demo.consumer.controller;

import com.cloud.demo.consumer.service.ProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>Feign风格消费入口</p>
 * @author dragons
 * @date 2020/9/3 22:31
 */
@RestController
public class FeignConsumerController {

    private final ProducerService producerService;

    /**
     * 构造器注入
     */
    @Autowired
    public FeignConsumerController(ProducerService producerService) {
        this.producerService = producerService;
    }

    /**
     * 消费接口
     */
    @GetMapping("/feign-consume")
    public String feignConsume(String content) {
        return "I am feign consumer, content:" + producerService.produce(content);
    }
}
